package leetcode.D2000.T1884;

/**
 * @File Info: leetcode -- <Solution>
 * @Author: 18362
 * @Create: 2022-03-12 22:02:48 星期六
 */

class Solution {
    public int twoEggDrop(int n) {
        int[] dp = new int[n+1];
        dp[0] = 0; dp[1] = 1;
        for(int i = 2; i<=n; ++i) {
            int res = Integer.MAX_VALUE;
            for(int j=1; j<i; ++j) {
                res = Math.min(res, Math.max(dp[i-j]+1, j));
            }
            dp[i] = res;
        }
        return dp[n];
    }
}
